<?php
include_once "../common.php";

if(isset($_GET['website']) && !empty($_GET['website']))
{
	$_GET['website'] = makeWebsiteFriendly($_GET['website']);
	// get webshop id...
	$query = "	SELECT 
					* 
				FROM Webshops 
				WHERE URL = '".str_replace("'","",$_GET['website'])."'
					AND CustomerID = '".str_replace("'","",$_SESSION['login']['ID'])."'";
	
	$result = $_MySQL->runQuery($query);
	if(mysql_num_rows($result) > 0)
	{
		$row = mysql_fetch_assoc($result);
		
		if($row['Metatag'] == '')
		{
			$newMETA = generateWebshopActivatiecode();
			$query = "	UPDATE Webshops SET
							Metatag = '".str_replace("'","",$newMETA)."'
						WHERE ID = '".str_replace("'","",$row['ID'])."'";
			$_MySQL->runQuery($query);
		}
		else
		{
			$newMETA = $row['Metatag'];
		}
		
		
		echo "Metatag: <br />";
		echo "<br />";
		echo '<input style="width:100%" type="text" value=\'&lt;meta name="prijsgezocht" content="'.$newMETA.'"&gt;\' /><br />';
		echo "<br />";
		echo "<br />";
		echo "<br />Voeg deze toe tussen de header tags";
		echo "<br />Bijvoorbeeld:";
		echo "<br />&lt;html&gt;";
		echo "<br />&lt;head&gt;";
		echo "<br />&lt;title&gt;Uw titel hier&lt;title&gt;";
		echo "<br />&lt;meta name=\"prijsgezocht\" content=\"".$newMETA."\"&gt;";
		echo "<br />&lt;\head&gt;";
		echo "<br />&lt;body&gt;";
		echo "<br />&lt;\body&gt;";
		echo "<br />&lt;\html&gt;";
		echo "<br /><br />";
		echo '<br /><br /><input type="button" value=" Valideren " onclick="javascript:validateMETA();" />';
		        	
	}
	else 
	{
		echo "Onbekende website '".$_GET['website']."'";
	}
}
else 
{
	echo "Onbekende website";
}
